package Presentation.GraphicUI;

import javax.swing.*;
import java.awt.*;

public class IconFactory {

    public static ImageIcon getImageIcon(String name) {
        return new ImageIcon(ClassLoader.getSystemResource(name));
    }

    private static ImageIcon imgWelcomePic = getImageIcon("Presentation/GraphicUI/images/welcome_pic.jpg");
    private static ImageIcon imgMainPic = getImageIcon("Presentation/GraphicUI/images/main_pic.jpg");

    public static final int MAIN_PIC = 0;
    public static final int WELCOME_PIC = 1;

    //Remember that it is always possible to the Java built-in icons so that you don't have to include your own standard icons.

    public static JPanel getIconForType(int iconType) {
        Icon icon = null;
        switch (iconType) {
            case MAIN_PIC:
                icon = imgMainPic;
                break;
            case WELCOME_PIC:
                icon = imgWelcomePic;
                break;
            case 2:
                icon = UIManager.getIcon("OptionPane.warningIcon");
                break;
            case 3:
                icon = UIManager.getIcon("OptionPane.questionIcon");
                break;
        }
        JPanel j = new JPanel(new FlowLayout(FlowLayout.CENTER));
        if (icon != null)
            j.add(new JLabel(icon));
        return j;
    }
}
